﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Common
{
    public class lstMenuManager
    {
        public const string UsersSessionKey = "Menus";

        public static List<LstMenu> GetMenu()
        {
            List<LstMenu> menus = null;
            if ((HttpContext.Current.Session[UsersSessionKey] != null) && (HttpContext.Current.Session[UsersSessionKey] is List<LstMenu>))
            {
                menus = HttpContext.Current.Session[UsersSessionKey] as List<LstMenu>;
            }
            else
            {
                menus = GetMockMenu();
                HttpContext.Current.Session[UsersSessionKey] = menus;
            }
            return menus;
        }

        private static List<LstMenu> GetMockMenu()
        {
            List<LstMenu> menus = new List<LstMenu>();
            LstMenu menu1 = new LstMenu("Trang chủ", "DVM_001", "Home", 0);
            LstMenu menu2 = new LstMenu("Tin tức", "DVM_002", "News", 1);
            LstMenu menu3 = new LstMenu("Hình ảnh", "DVM_003", "image", 2);
            LstMenu menu4 = new LstMenu("Nhạc chuông", "DVM_004", "Music", 3);
            LstMenu menu5 = new LstMenu("Truyện", "DVM_005", "Story", 4);
            LstMenu menu6 = new LstMenu("Tư vấn", "DVM_006", "Consul", 5);
            menus.Add(menu1);
            menus.Add(menu2);
            menus.Add(menu3);
            menus.Add(menu4);
            menus.Add(menu5);
            menus.Add(menu6);

            return menus;
        }

    }
}
